import { DateTransformer } from './../utils/dateTransformer';
import { Entity, Column, PrimaryGeneratedColumn, CreateDateColumn, UpdateDateColumn } from 'typeorm';

import { Exclude } from 'class-transformer';
import { CommonEntity } from './common.entity';

@Entity('banners')
export class BannersEntity extends CommonEntity {

    @PrimaryGeneratedColumn()
    id: string 

    @Exclude()
    @Column({ comment: '标题' }) 
    title: string

    @Column({ comment: '简介' })
    intro: string

    @Column({ comment: '图片地址' })
    img: string

    @Column({ comment: '外链跳转地址' })
    linkUrl: string

    @Column({ comment: 'app内跳转地址' })
    path: string

    @Column({ comment: '1：排序标志', default: 0 })
    sort: number

    @Column({ comment: '0:关闭，1:开启', width: 1, default: 1 })
    status: number

    @Column({ comment: '开始时间', type: 'datetime',transformer: new DateTransformer()})
    startAt: string

    @Column({ comment: '结束时间', type: 'datetime',transformer: new DateTransformer()})
    endAt: string 
}     